#!/bin/bash # It is recommended to test the script on a local machine for its purpose and effects. # ManageEngine Desktop Central will not be responsible for any # damage/loss to the data/setup based on the behavior of the script. # Description - Script to push certificate into Mac # Script Arguments - "" (Should be the exact name as in dependency file) # Dependency Files - "" # Configuration - COMPUTER # Note - Mac machines with macOS BigSur and above will not allow root certificate addition without manual authentication, due to the new Apple security feature. [SecTrustSettingsSetTrustSettings: The authorization was denied since no user interaction was possible, This error will occur in Bigsur and above OS machines] CERTNAME=$1 echo "$CERTNAME" sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" "$CERTNAME" errcode=$? if [ "$errcode" -ne 0 ]; then echo "" echo "Failed to push certificate with errorcode $errcode" 1>&2 echo "" exit 1 fi echo "Successfully installed certificate" 1>&2